<template>
  <div>
    <el-form :model="functionAuthModel" ref="functionAuthEditForm">
      <el-row>
        <el-col>
          <el-form-item label="Function Description:">{{functionAuthModel.functionName}}
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-show="baseInfo.isStatusRelated">
        <el-col>
          <el-form-item label="Authorized to following statuses:">
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-show="baseInfo.isStatusRelated">
        <el-col>
          <el-form-item>
            <el-checkbox-group v-model="functionAuthModel.statusSelectionList">
              <el-checkbox
                v-for="item in baseInfo.statusList"
                :key="item.id"
                :label="item.statusName"
              ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-show="baseInfo.isRoleRelated">
        <el-col>
          <el-form-item label="Authorized to following roles:">
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-show="baseInfo.isRoleRelated">
        <el-col>
          <el-form-item>
            <el-checkbox-group v-model="functionAuthModel.rolesSelectionList">
              <el-checkbox
                v-for="item in baseInfo.rolesList"
                :label="item.roleName"
                :key="item.id"
              ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>

export default {
  data() {
    return {
      baseInfo: {
        rolesList: [],
        statusList: [],
        isRoleRelated: false,
        isStatusRelated: false
      },
      functionAuthModel: {
        functionName: '',
        functionId: '',
        statusSelectionList: [],
        rolesSelectionList: []
      }
    }
  },
  mounted() {

  },
  methods: {
    setDataToFunctionAuthEditForm(functionAuthModel, baseInfo) {
      this.functionAuthModel = functionAuthModel
      this.baseInfo = baseInfo
    },
    getFunctionAuthEditModel() {
      return this.functionAuthModel
    },
    validateForm(fn) {
      return this.$refs.functionAuthEditForm.validate()
    }
  }
}
</script>

<style scoped>

</style>
